home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 5
/
Gekikoh Dennoh Club Vol. 5 (Japan).7z
/
Gekikoh Dennoh Club Vol. 5 (Japan) (Track 01).bin
/
internet
/
tcppack
/
tcppackb.lzh
/
src
/
libnetwork
/
iface.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-10
|
3KB
|
139 lines
/*
* iface.c
*
* Copyright (C) 1994 First Class Technology.
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"tcpipdrv.h"
#include"network.h"
_ti_func search_ti_entry (void);
/************************************************
* *
************************************************/
iface *
get_iface_list (void)
{
_ti_func func = search_ti_entry ();
if (func)
return (iface *)func (_TI_get_iface_list, NULL);
return 0;
}
/************************************************
* *
************************************************/
iface *
iface_lookup (long ipaddr)
{
iface *top, *cur;
top = get_iface_list ();
for (cur = top; cur != NULL; cur = cur->next)
{
if (ipaddr == cur->my_ip_addr)
break;
}
return cur;
}
/************************************************
* *
************************************************/
iface *
iface_lookupn (char *name)
{
iface *top, *cur;
top = get_iface_list ();
for (cur = top; cur != NULL; cur = cur->next)
{
if (!strcmp (name, cur->name))
break;
}
return cur;
}
/************************************************
* *
************************************************/
int
ismyipaddr (long ipaddr)
{
iface *top, *cur;
top = get_iface_list ();
for (cur = top; cur != NULL; cur = cur->next)
{
if (ipaddr == cur->my_ip_addr)
return 1;
}
return 0;
}
/************************************************
* *
************************************************/
long *
get_my_ipaddr (int *n)
{
iface *top, *cur;
long *array, *p;
top = get_iface_list ();
*n = 0;
for (cur = top; cur != NULL; cur = cur->next)
(*n)++;
array = malloc (sizeof (long) * *n);
if (!array)
return NULL;
p = array;
for (cur = top; cur != NULL; cur = cur->next)
*p++ = cur->my_ip_addr;
return array;
}
/************************************************
* *
************************************************/
iface *
get_new_iface (char *name)
{
_ti_func func = search_ti_entry ();
if (func)
return (iface *)func (_TI_get_new_iface, (long *)name);
return 0;
}
/************************************************
* *
************************************************/
void
link_new_iface (iface *n_i)
{
_ti_func func = search_ti_entry ();
if (func)
{
func (_TI_link_new_iface, (long *)n_i);
return;
}
return;
}